﻿using UnityEngine;
using System.Collections;

public class collision : MonoBehaviour {
	public static bool ColliderState = false;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	void FixedUpdate() {
		if (ColliderState == true) {
			ColliderState = false;
			gameObject.rigidbody2D.position = new Vector2(-9,3);
			gameObject.rigidbody2D.velocity = new Vector2(0,0);
				}
	}
	void OnTriggerEnter2D(Collider2D other) {
		if(other.gameObject.name == "Enemy(Clone)" || other.gameObject.tag == "Wall")
		{
			ColliderState = true;	
		}
		
		
	}

	void OnTriggerStay2D(Collider2D other) {
		if(other.gameObject.name == "Enemy(Clone)")
		{
			//rigidbody2D.MovePosition(new Vector2(-9, 3));
		
		}
		
		
	}

	void OnTriggerExit2D(Collider2D other) {
		if(other.gameObject.name == "Enemy(Clone)")
		{
			//rigidbody2D.MovePosition( new Vector2(-9, 3) );
		}
		
		
	}
}
